﻿<!--#include file="inc/common.asp" -->
<%
'Blog文章删除功能模块
'
'author: evan zhao
'

  if userObj.userId=""  then
    assertConnected()
    call closeDb()  
    response.clear
    response.redirect("login.asp?blog_id=" & blogObj.blogId & "&cat_id=" & blogCatObj.catId & "&content_id=" & request("content_id"))
    response.end
  end if
  
  if blogCatObj.isRSS then
    message("本文内容从RSS源自动获取，无法删除")
  end if
  
  call openDB

  dim content_id
  content_id = clng(request("content_id"))
  

  dim blogItem
  set blogItem = new BlogItemClass
  if not blogItem.load(content_id) then
    message("文章不存在")
  end if

  if userRightObj.canDeleteItem(blogItem) then
        conn.execute(" delete from blog_content where content_id=" & content_id)

        call blogItem.clean()
        
        call blogObj.loadTopItemsFromDB()
        call blogObj.loadTopCommentsFromDB()
        call blogObj.cache()
        
        call blogCatObj.loadTotalItemCountFromDB()
        call blogCatObj.cache()        

        'message("删除成功")
        call closeDB()
        response.redirect "index.asp?blog_id=" & blogObj.blogId & "&cat_id=" & blogCatObj.catId & "&pageno=" & request("pageno")

  else
        message("您没有删除权限")
  end if

%>


<!--#include file="inc/end.asp" -->
